<h1>Overview</h1>

<p>Roassal 3d is an agile visualization for 3d rendering. Roassal 3d offers a high level domain specific languages to easily create and animate 3d visualization from any arbitrary domain.</p>

<p>Roassal 3d has been designed for Pharo 3.0. A configuration is available from the Configuration Browser. Alternatively, you can simply execute the following:</p>

<pre>Gofer new 
	smalltalkhubUser: 'ronsaldo' project: 'roassal3d';
	package: 'ConfigurationOfRoassal3d';
	load.
(Smalltalk at: #ConfigurationOfRoassal) loadDevelopment</pre>

<p>Some examples, to try in a workspace:</p>

<pre>
| view e anime |
view := R3View new.
e := R3CubeShape element.
view add: e.
anime := R3Rotate new.
anime nbCycles: 100.
anime after: [ e shape color: Color red ].
anime on: e by: (R3Vector3 newY: Float twoPi).
view addAnimation: anime.
view addInteraction: R3MKControl.
view open.
</pre>
<img src="/pages/products/roassal3d/img1.png">

<pre>
| view meshBuilder e |
view := R3View new.
meshBuilder := R3MeshBuilder new.
meshBuilder
	addX: 0 y: 0 z: 0;
	addX: 1 y: 0 z: 0;
	addX: 1 y: 1 z: 0;
	addX: 0 y: 1 z: 0;
	addX: 0 y: 0 z: 1;
	addX: 1 y: 0 z: 1;
	addX: 1 y: 1 z: 1;
	addX: 0 y: 1 z: 1;
	addPolygon: { 1. 2. 3. 4 };
	addPolygon: { 5. 6. 7. 8 }.

meshBuilder computeNormals.
meshBuilder endTriangleSubmesh:
R3Material new.
e := (R3MeshShape newWithMesh:
meshBuilder mesh) element.
e shape color: Color blue.
view add: e.
view adjustCamera.
view addInteraction: R3MKControl.
view open.

</pre>
<img src="/pages/products/roassal3d/img2.png">

<pre>
| view  shape elements angles random |
elements := OrderedCollection new.
random := Random new.
{ R3CubeShape->(Color gray). 
R3UVSphereShape->(Color purple).
R3ConeShape->(Color red).
R3CylinderShape ->(Color green).

R3PyramidShape->(Color blue) } do: [ :association | 
	| width height depth |
	view := R3View new.
	width := random next.
	height := random next.
	depth := random next.
	shape := association key new
		width: [ :e | e model* width+0.5 ];
		height: [ :e | e model * height+0.5 ];
		depth: [ :e | e model * depth+0.5 ].
	shape color: association value.
	(1 to: 10) do: [ :i | | e |
		e := (shape elementOn: i).
		angles := R3Vector3 
			x: (45 * random next) 
			y: (90 * random next)
			z: (180 * random next).
		e orientation: (R3Matrix3 xyzRot:  angles degreesToRadians) .
		elements add: e  ].
].
elements do: [ :e | 
	view addAnimation: (R3Rotate on: e by: (R3Vector3 newZ: Float twoPi)). ].
R3CubeLayout  on: elements.
view addAll: elements.
view add: (R3PointLight 
	position: (R3Vector3 newX: 0.5 y: 0 z: 0) color: Color yellow).
view add: (R3PointLight 
	position: (R3Vector3 newX: 3 y: 3 z: 0) color: Color cyan).
view add: (R3PointLight position: 
	(R3Vector3 newX: 0 y: -3 z: 3) color: Color magenta).
view addInteraction: R3MKControl.
view adjustCamera.
view open

</pre>
<img src="/pages/products/roassal3d/img3.png">

<pre class="op-fix">
| view e1 radius subshapes |
view := R3View new.
e1 := R3ConeShape element.
e1 translateToX: 1 y: 2 z: 1.
view add: e1.
radius := 5.
subshapes := 20.
(0 to: subshapes) do: [ :i | | temp cp1 sin cos angle cp2 |
	temp := i even ifTrue:[ R3CubeShape element] 
		ifFalse: [R3UVSphereShape element].
	angle := i * Float twoPi / subshapes.
	sin := (angle sin * radius).
	cos := (angle cos * radius).
	temp translateToX: sin y: -2 z: cos.
	view add: temp.
	cp2 := R3Vector3 newX: sin y: 2 z: cos.
	cp1 := R3Vector3 newX: 1 y: -2 z: 1.
	view add: (R3BezierLineShape blue 
		elementFrom: e1 
		control: cp1 
		control2: cp2 
		to: temp). ].

view addInteraction: R3MKControl new.
view adjustCamera.
view open .
</pre>
<img src="/pages/products/roassal3d/img4.png" class="op-fix">

<p>More examples may be found in the class R3Example and in </p>
<a href="https://www.dropbox.com/s/mctbza5qfcdxbs3/Roassal3dtutorial.pdf" class="op-a" target="_blank">https://www.dropbox.com/s/mctbza5qfcdxbs3/Roassal3dtutorial.pdf</a>